package com.yy.controller;

import com.yy.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author young
 * @date 2022/12/18 20:14
 * @description:
 */
@RestController
@Slf4j
@RequestMapping("order")
public class ConsulConsumerController {
    public static final String PAYMENT_URL="http://consul-provider-server";
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/test")
    public Result<String> test(){
        return Result.ok(restTemplate.getForObject(PAYMENT_URL+"/consul/test",String.class));
    }
}
